The Southern Oscillation Index (SOI) is an indicator of the development and intensity of El Niño (negative SOI) or La Niña (positive SOI) events in the Pacific Ocean. These data also include the estimate of “recruitment”, which indicate fish population sizes in the southern hemisphere.
# A tsibble: 453 x 3 [1M]
date soi recruitment
<mth> <dbl> <dbl>
1 1950 Jan 0.377 68.6
2 1950 Feb 0.246 68.6
3 1950 Mar 0.311 68.6
4 1950 Apr 0.104 68.6
5 1950 May -0.016 68.6
6 1950 Jun 0.235 68.6
7 1950 Jul 0.137 59.2
8 1950 Aug 0.191 48.7
9 1950 Sep -0.016 47.5
10 1950 Oct 0.29 50.9
# ℹ 443 more rows
All happy families are alike; each unhappy family is unhappy in its own way.
Tolstoy, Anna Karenina
This applies to time series models as well, just replace happy family with stationary model.
A simple example of a non-stationary time series is a trend stationary model
\[ y_t = \mu(t) + w_t \]
where \(\mu(t)\) denotes a time dependent trend and \(w_t\) is a white noise (stationary) process.
Linear trend model
Lets imagine a simple model where \(y_t = \delta + \beta t + x_t\) where \(\delta\) and \(\beta\) are constants and \(x_t\) is a stationary process.
Differencing
An simple approach to remove trend is to difference your response variable, specifically examine \(d_t = y_t - y_{t-1}\) instead of \(y_t\).
Is the linear trend model stationary after differencing?
Detrending vs Differencing
Quadratic trend model
Lets imagine another simple model where \(y_t = \delta + \beta t + \gamma t^2 + x_t\) where \(\delta\), \(\beta\), and \(\gamma\) are constants and \(x_t\) is a stationary process.
Detrending
2nd order differencing
Let \(d_t = y_t - y_{t-1}\) be a first order difference then \(d_t - d_{t-1}\) is a 2nd order difference.
Is the quadratic trend model stationary after 2nd order differencing?
Differencing
Differencing - ACF
AR Models
AR(1)
Last time we mentioned a random walk with trend process where \(y_t = \delta + y_{t-1} + w_t\).
The AR(1) process is a generalization of this where we include a coefficient in front of the \(y_{t-1}\) term.